VERSION= V5


pull:
	docker pull registry.cn-beijing.aliyuncs.com/loaking/postgresql:V2
	docker pull registry.cn-beijing.aliyuncs.com/loaking/mysql:$(VERSION)
	docker pull registry.cn-beijing.aliyuncs.com/loaking/userregister:$(VERSION)
	docker pull registry.cn-beijing.aliyuncs.com/loaking/userlogin:$(VERSION)
	docker pull registry.cn-beijing.aliyuncs.com/loaking/dormlist:$(VERSION)
	docker pull registry.cn-beijing.aliyuncs.com/loaking/node:V1

push:

	docker tag dormdb:V5 registry.cn-beijing.aliyuncs.com/loaking/mysql:$(VERSION)
	docker push registry.cn-beijing.aliyuncs.com/loaking/mysql:$(VERSION)
	docker rmi registry.cn-beijing.aliyuncs.com/loaking/mysql:$(VERSION)

	docker tag userregister:$(VERSION) registry.cn-beijing.aliyuncs.com/loaking/userregister:$(VERSION)
	docker push registry.cn-beijing.aliyuncs.com/loaking/userregister:$(VERSION)
	docker rmi registry.cn-beijing.aliyuncs.com/loaking/userregister:$(VERSION)

	docker tag userlogin:$(VERSION) registry.cn-beijing.aliyuncs.com/loaking/userlogin:$(VERSION)
	docker push registry.cn-beijing.aliyuncs.com/loaking/userlogin:$(VERSION)
	docker rmi registry.cn-beijing.aliyuncs.com/loaking/userlogin:$(VERSION)

	docker tag dormlist:$(VERSION) registry.cn-beijing.aliyuncs.com/loaking/dormlist:$(VERSION)
	docker push registry.cn-beijing.aliyuncs.com/loaking/dormlist:$(VERSION)
	docker rmi registry.cn-beijing.aliyuncs.com/loaking/dormlist:$(VERSION)

	docker tag node:$(VERSION) registry.cn-beijing.aliyuncs.com/loaking/node:$(VERSION)
	docker push registry.cn-beijing.aliyuncs.com/loaking/node:$(VERSION)
	docker rmi registry.cn-beijing.aliyuncs.com/loaking/node:$(VERSION)

run:
	make pull
	export VERSION=$(VERSION)
	docker-compose -f docker-compose-deploy.yml up -d

clean:
	docker kill $$(docker ps -a -q)
	docker rm $$(docker ps -a -q)
	docker rmi -f $$(docker images -q)